#include <iostream>
#include <csignal>
#include <unistd.h>

void signalhandler(int signum){
	std::cout<<"signal "<<signum<<" received"<<std::endl;
	sleep(3);
	exit(1);
}

int main(){
	signal(SIGINT, signalhandler);
	int cnt = 0;
	while(true){
		std::cout<<"hello world "<<cnt++<<" times"<<std::endl;
		sleep(1);
	}

	return 0;
}